import PlayerInterface from '../../common_models/Player_Interface'
// 玩家类
export default class Player implements PlayerInterface {
    token: string
    socketID: string
    gameNumber: number
    seat: number
    character: string
    alive: boolean
    constructor(
        {
            token,
            socketID,
            gameNumber
        }
            :
            {
                token: string,
                socketID: string,
                gameNumber: number
            }
    ) {
        this.token = token;             // token
        this.socketID = socketID;       // socketID
        this.gameNumber = gameNumber;   // 玩家正在参与的局号码
        this.seat = 0;                  // 座位
        this.character = '';            // 角色
        this.alive = true;              // 是否存活
    }

    sitDown(n:number) {
        // 改变当前连接的这个对象
        this.seat = n
    }
    standUp() {
        // 改变当前连接的这个对象
        this.seat = 0
    }
    // 得到非敏感玩家数组数据
    getNonSecretPlayerData() {
        return {
            seat: this.seat,
            alive: this.alive,
            token: this.token
        }
    }
}
